<?php

/**
 * Camara form base class.
 *
 * @package    form
 * @subpackage camara
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseCamaraForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'cd_camara'         => new sfWidgetFormInputHidden(),
      'cd_tipo_camara'    => new sfWidgetFormDoctrineChoice(array('model' => 'TipoCamara', 'add_empty' => false)),
      'cd_usr_secretario' => new sfWidgetFormDoctrineChoice(array('model' => 'Usuario', 'add_empty' => false)),
      'no_longo'          => new sfWidgetFormInput(),
      'name'              => new sfWidgetFormInput(),
      'sg_camara'         => new sfWidgetFormInput(),
      'deleted'           => new sfWidgetFormInputCheckbox(),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
      'slug'              => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'cd_camara'         => new sfValidatorDoctrineChoice(array('model' => 'Camara', 'column' => 'cd_camara', 'required' => false)),
      'cd_tipo_camara'    => new sfValidatorDoctrineChoice(array('model' => 'TipoCamara')),
      'cd_usr_secretario' => new sfValidatorDoctrineChoice(array('model' => 'Usuario')),
      'no_longo'          => new sfValidatorString(array('max_length' => 255)),
      'name'              => new sfValidatorString(array('max_length' => 50)),
      'sg_camara'         => new sfValidatorString(array('max_length' => 10)),
      'deleted'           => new sfValidatorBoolean(),
      'created_at'        => new sfValidatorDateTime(array('required' => false)),
      'updated_at'        => new sfValidatorDateTime(array('required' => false)),
      'slug'              => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorAnd(array(
        new sfValidatorDoctrineUnique(array('model' => 'Camara', 'column' => array('name'))),
        new sfValidatorDoctrineUnique(array('model' => 'Camara', 'column' => array('sg_camara'))),
        new sfValidatorDoctrineUnique(array('model' => 'Camara', 'column' => array('slug'))),
      ))
    );

    $this->widgetSchema->setNameFormat('camara[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Camara';
  }

}
